<template>
  <div class="about-container">
    <!-- 顶部导航 -->
    <div class="header">
      <div class="back-button" @click="goBack">
        <van-icon name="arrow-left" size="20" />
      </div>
      <h1 class="header-title">关于我们</h1>
    </div>
    
    <!-- 应用信息 -->
    <div class="app-info">
      <div class="app-logo">
        <img src="@/assets/images/logo.svg" alt="BTDApp Logo" />
      </div>
      <h2 class="app-name">BTDApp</h2>
      <div class="app-version">v1.0.0</div>
    </div>
    
    <!-- 功能列表 -->
    <div class="feature-list">
      <van-cell-group inset>
        <van-cell 
          title="用户协议" 
          is-link 
          @click="navigateTo('/agreement/user')"
        />
        <van-cell 
          title="隐私政策" 
          is-link 
          @click="navigateTo('/agreement/privacy')"
        />
        <van-cell 
          title="检查更新" 
          is-link 
          @click="checkUpdate"
        />
        <van-cell 
          title="联系我们" 
          is-link 
          @click="showContactInfo = true"
        />
        <van-cell 
          title="关注我们" 
          is-link 
          @click="showSocialMedia = true"
        />
      </van-cell-group>
    </div>
    
    <!-- 公司信息 -->
    <div class="company-info">
      <p>BTDApp 是一款专注于区块链资产管理的应用</p>
      <p>© 2025 BTDApp. All Rights Reserved.</p>
    </div>
    
    <!-- 联系我们弹窗 -->
    <van-popup
      v-model:show="showContactInfo"
      round
      position="bottom"
      :style="{ height: '40%',maxWidth: '800px', left: '50%', transform: 'translateX(-50%)' }"
      closeable
    >
      <div class="popup-content">
        <h3 class="popup-title">联系我们</h3>
        
        <div class="contact-list">
          <div class="contact-item">
            <van-icon name="phone-o" class="contact-icon" />
            <div class="contact-info">
              <div class="contact-label">客服电话</div>
              <div class="contact-value">400-123-4567</div>
              <div class="contact-note">工作时间：9:00-18:00（节假日不休）</div>
            </div>
          </div>
          
          <div class="contact-item">
            <van-icon name="envelop-o" class="contact-icon" />
            <div class="contact-info">
              <div class="contact-label">电子邮箱</div>
              <div class="contact-value">support@btdapp.com</div>
            </div>
          </div>
          
          <div class="contact-item">
            <van-icon name="location-o" class="contact-icon" />
            <div class="contact-info">
              <div class="contact-label">公司地址</div>
              <div class="contact-value">中国广东省深圳市南山区科技园南路XX号XX大厦</div>
            </div>
          </div>
        </div>
      </div>
    </van-popup>
    
    <!-- 社交媒体弹窗 -->
    <van-popup
      v-model:show="showSocialMedia"
      round
      position="bottom"
      :style="{ height: '40%' ,maxWidth: '800px', left: '50%', transform: 'translateX(-50%)'}"
      closeable
    >
      <div class="popup-content">
        <h3 class="popup-title">关注我们</h3>
        
        <div class="social-list">
          <div class="social-item">
            <div class="qr-code">
              <img src="https://via.placeholder.com/120" alt="微信公众号" />
            </div>
            <div class="social-name">微信公众号</div>
            <div class="social-id">BTDApp</div>
          </div>
          
          <div class="social-item">
            <div class="qr-code">
              <img src="https://via.placeholder.com/120" alt="微博" />
            </div>
            <div class="social-name">微博</div>
            <div class="social-id">@BTDApp官方</div>
          </div>
        </div>
      </div>
    </van-popup>
    
    <!-- 检查更新弹窗 -->
    <van-dialog
      v-model:show="showUpdateDialog"
      title="检查更新"
      :show-cancel-button="false"
      confirm-button-text="我知道了"
    >
      <div class="update-content">
        <van-icon name="checked" size="40" class="update-icon" />
        <p>当前已是最新版本 v1.0.0</p>
      </div>
    </van-dialog>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import { showToast } from 'vant'

const router = useRouter()

// 弹窗状态
const showContactInfo = ref(false)
const showSocialMedia = ref(false)
const showUpdateDialog = ref(false)

// 返回上一页
const goBack = () => {
  router.back()
}

// 导航到指定页面
const navigateTo = (path) => {
  router.push(path)
}

// 检查更新
const checkUpdate = () => {
  showToast({
    type: 'loading',
    message: '正在检查更新...',
    forbidClick: true,
    duration: 1500
  })
  
  setTimeout(() => {
    showUpdateDialog.value = true
  }, 1500)
}
</script>

<style scoped>
.about-container {
  min-height: 100vh;
  background-color: #f8fafc;
  padding-bottom: 24px;
}

/* 顶部导航 */
.header {
  display: flex;
  align-items: center;
  padding: 16px;
  background-color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.back-button {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  cursor: pointer;
  color: #334155;
  background: transparent;
  border: none;
  padding: 0;
}

.header-title {
  font-size: 18px;
  font-weight: 600;
  color: #1e293b;
}

/* 应用信息 */
.app-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 0;
  background-color: #ffffff;
}

.app-logo {
  width: 80px;
  height: 80px;
  margin-bottom: 16px;
}

.app-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.app-name {
  font-size: 20px;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 8px;
}

.app-version {
  font-size: 14px;
  color: #64748b;
}

/* 功能列表 */
.feature-list {
  margin: 16px 0;
}

/* 公司信息 */
.company-info {
  text-align: center;
  padding: 24px 16px;
  color: #64748b;
}

.company-info p {
  font-size: 14px;
  margin: 4px 0;
}

/* 弹窗内容 */
.popup-content {
  padding: 24px;
}

.popup-title {
  font-size: 18px;
  font-weight: 600;
  color: #1e293b;
  text-align: center;
  margin-bottom: 24px;
}

/* 联系信息 */
.contact-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.contact-item {
  display: flex;
  align-items: flex-start;
}

.contact-icon {
  font-size: 24px;
  color: #3b82f6;
  margin-right: 16px;
  margin-top: 2px;
}

.contact-info {
  flex: 1;
}

.contact-label {
  font-size: 16px;
  font-weight: 500;
  color: #1e293b;
  margin-bottom: 4px;
}

.contact-value {
  font-size: 14px;
  color: #334155;
  margin-bottom: 4px;
}

.contact-note {
  font-size: 12px;
  color: #64748b;
}

/* 社交媒体 */
.social-list {
  display: flex;
  justify-content: space-around;
  padding: 0 16px;
}

.social-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.qr-code {
  width: 120px;
  height: 120px;
  margin-bottom: 12px;
}

.qr-code img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
}

.social-name {
  font-size: 16px;
  font-weight: 500;
  color: #1e293b;
  margin-bottom: 4px;
}

.social-id {
  font-size: 14px;
  color: #64748b;
}

/* 更新弹窗 */
.update-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0;
}

.update-icon {
  color: #10b981;
  margin-bottom: 16px;
}

.update-content p {
  font-size: 16px;
  color: #334155;
  margin: 0;
}
</style>